package cn.iocoder.yudao.module.system.dal.mysql.shop;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.shop.ShopDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.shop.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 店铺 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ShopMapper extends BaseMapperX<ShopDO> {

    default PageResult<ShopDO> selectPage(ShopPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopDO>()
                .eqIfPresent(ShopDO::getId, reqVO.getId())
                .eqIfPresent(ShopDO::getShopId, reqVO.getShopId())
                .orderByDesc(ShopDO::getId));
    }

    // 自定义查询方法，根据用户ID查询所拥有的店铺信息
    List<ShopDO> selectUserShops(@Param("userId") Long userId);
}